using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class web_Controls_ccld_td : System.Web.UI.UserControl
{
    public Common comm = new Common();
    public DataTable dtt_main, dtt_sub;
    public string sql = "", sql_sub = "", sql_where = "", messDate = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        dtt_sub = comm.getDataTable("select banner_path from HeThong_config where id=4 or id=5");
        if (!string.IsNullOrEmpty(dtt_sub.Rows[0][0].ToString()))
        {
            DateTime t1 = DateTime.ParseExact(dtt_sub.Rows[0][0].ToString().Split(';')[0].ToString(),"dd-MM-yyyy",null);
            DateTime t2 = DateTime.ParseExact(dtt_sub.Rows[0][0].ToString().Split(';')[1].ToString(),"dd-MM-yyyy",null);
            sql_where = " and D.ngay_dang BETWEEN '" + t1.ToString("MM-dd-yyyy") + "' AND '" + t2.ToString("MM-dd-yyyy") + "' ";
        }
        if (!string.IsNullOrEmpty(dtt_sub.Rows[1][0].ToString()))
        {
            sql_where += " and A.ma_doanh_nghiep IN (select ma_doanh_nghiep from SanGiaoDich_doanh_nghiep where ma_san='" +
                dtt_sub.Rows[1][0].ToString() + "')";
        }
        sql = "select a.*, b.ma_doanh_nghiep,b.Ten_doanh_nghiep,b.hinh_anh  from ViecLamTrong_ho_so_tuyen_dung as a "+
            "inner join DoanhNghiep_doanh_nghiep as b on a.ma_doanh_nghiep = b.ma_doanh_nghiep where a.ma_doanh_nghiep in "+
            "(SELECT a.ma_doanh_nghiep FROM dbo.DoanhNghiep_doanh_nghiep as a LEFT JOIN dbo.ViecLamTrong_ho_so_tuyen_dung AS D "+
            "ON a.ma_doanh_nghiep = D.ma_doanh_nghiep WHERE A.kich_hoat= 1 GROUP BY a.ma_doanh_nghiep,a.Ten_doanh_nghiep,a.hinh_anh)and a.kich_hoat=1 and ngay_het_han >= getdate()";
        dtt_main = comm.getDataTable(sql);
        //Response.Write(sql);
    }
}
